<?php
class news_add extends SClass {

    public function process() {
        try {
    		if ($this->getControlValue('add')) {
    			ServiceUtils::GetFactory()->getNewsService()->addNews(
    				$this->getControlValue('title'),
    				$this->getControlValue('preview'),
    				$this->getControlValue('content'),
                                $this->getControlValue('date')
    			);
    			$this->assign('message', 'ok');
    		}
    	} catch (ServiceUtils_Exception $exception) {
    		$this->assign('errors', $exception->getErrors());
    	}
    }

}
